<?php

// $Id$

require_once(TANGRA_MAIN_DIR.'form/guardable_form.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/text/form_field_text.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/select/form_field_select.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/checkbox/form_field_checkbox.class.php');
require_once(TANGRA_MAIN_DIR.'/form/static_html_form_generator.class.php');



class VPT_CI_Form extends Guardable_Form {
	function __construct() {
		parent::__construct('vpt_ci', 'admin/modules/tangra_cms/vpage/vpt_ci_edit.php');

		$f_ci_name = new Form_Field_Text('ci_name', true, 255);
		$this->add_field($f_ci_name);

		$f_ci_type = new Form_Field_Select('ci_type', 0, true, 0);
		$this->add_field($f_ci_type);


		$f_required = new Form_Field_Checkbox('required', false);
		$this->add_field($f_required);

		$f_export_name = new Form_Field_Text('export_name', true, 255);
		$f_export_name->add_potential_error('invalid_export_name');
		$f_export_name->add_potential_error('duplicate_export_name');
		$this->add_field($f_export_name);
	}


	public function generate_html() {
		$html_gen = new Static_HTML_Form_Generator($this, 'modules/form_html_tpl_static_ajax_metallic_en', 'en');
		$html_gen->create_default_tpl_maps();
		$html_gen->change_field_p_error_map_entry('export_name', 'invalid_export_name', 'modules/tangra_cms/forms/en/vpt_ci/field_error_invalid_export_name_en.tpl');
		$html_gen->change_field_p_error_map_entry('export_name', 'duplicate_export_name', 'modules/tangra_cms/forms/en/vpt_ci/field_error_duplicate_export_name_en.tpl');

		printbr('<pre>');
		printbr(htmlentities($html_gen->get_static_html()));
		printbr('</pre>');
	}
}
